<?php

namespace app\screen\controller;

use app\common\lib\Show;
use think\response\Json;

class Post extends ApiBase
{
    /**
     * 查询零工驿站列表
     * @return Json
     */
    public function list(): Json
    {
        try {
            $list = (new \app\common\business\Post())->getListByWhere([],null,null);
        } catch (\Exception $e) {
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        return Show::success($list);
    }

    /**
     * 查询零工驿站详情
     * @return Json
     */
    public function detail(): Json
    {
        $id=$this->request->get('id');
        if(empty($id)){
            return Show::error([],'参数错误');
        }
        try {
            $data = (new \app\common\business\Post())->getNormalById($id);
        } catch (\Exception $e) {
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        return Show::success($data);
    }
}
